//
//  PictureDetailTableViewCell.m
//  bh
//
//  Created by lanou on 15/12/23.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "PictureDetailTableViewCell.h"

@implementation PictureDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _authorFaceView = [[UIImageView alloc]initWithFrame:(CGRectMake(10, 5, 60, 60))];
        self.authorFaceView.userInteractionEnabled = YES;
        
        //将图片设置为圆角的
        _authorFaceView.layer.masksToBounds = YES;
        _authorFaceView.layer.borderWidth = 2;
        _authorFaceView.layer.cornerRadius = _authorFaceView.bounds.size.width / 2;
        _authorFaceView.layer.borderColor = [UIColor orangeColor].CGColor;
        
        
        [self.contentView addSubview:_authorFaceView];
        
        _authorNickLabel = [[UILabel alloc]initWithFrame:(CGRectMake(kWidth / 5, 5, 300, 25))];
        _authorNickLabel.textColor = [UIColor orangeColor];
        [self.contentView addSubview:_authorNickLabel];
        
        _colNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(kWidth / 5, 35, 300, 25))];
        _colNameLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_colNameLabel];
        
        _picView = [[UIImageView alloc]initWithFrame:(CGRectMake(kWidth - 100, 5, 60, 60))];
        [self.contentView addSubview:_picView];
        
        UIImageView *rowView = [[UIImageView alloc]initWithFrame:(CGRectMake(kWidth - 25, 22, 15, 20))];
        rowView.image = [UIImage imageNamed:@"title入口arrow-小@2x.png"] ;
        [self.contentView addSubview:rowView];
        
        
        
                
    }
    return self;
}


- (void)setPicture:(Picture *)picture{
    
    if (_picture != picture) {
        _picture = picture;
        
        [_authorFaceView setImageWithURL:[NSURL URLWithString:picture.author_face]];
        
        _authorNickLabel.text = picture.author_nick;
        
        _colNameLabel.text = picture.col_name;
        
        [_picView setImageWithURL:[NSURL URLWithString:picture.col_cover]];
        
    }
    
}







- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
